<extend name="Public:base"/>

<block name="main">
    <div id="yzh-content" class="col-xs-12">
      <div class="main-title">
        <h2>数据库管理</h2>
      </div>

    <div class="table-actions">
        <a href="{:U('Database/index')}" class="btn btn-sm btn-primary">数据库管理</a>
        <a href="{:U('Database/recover')}" class="btn btn-sm btn-primary">备份管理</a>
        <a class="btn btn-sm btn-primary" onclick="myform.action='{:U('Database/backup')}';$('#myform').submit();">立即备份</a>
        <a class="btn btn-sm btn-primary" onclick="myform.action='{:U('Database/recover?do=delete')}'; $('#myform').submit();">删除</a>
    </div>

    <div class="row">
        <form id="myform" name="myform" method="post" action="">
            <table class="table table-bordered">
                <thead>
                <tr>
                  <th class="w-50"><input type="checkbox" id="check_box" onclick="selectall('files[]');"></th>
                  <th align="left">名称</th>
                  <th align="left">大小</th>
                  <th align="left">备份时间</th>
                  <th align="left">下载</th>
                  <th align="left" style="width:8%">还原数据</th>
                </tr>
              </thead>

            <tbody>
            <volist name="files" id="vo">
            <tr>
              <td><input type="checkbox" name="files[]" value="{$vo.path}"> </td>
              <td>{$vo.name}</td>
              <td>{$vo.size|byte_format}</td>
              <td>{$vo.time|toDate}</td>
              <td><a class="btn btn-xs btn-primary" href="javascript:window.location='{:U('Database/download?filename='.$vo[name])}'">下载</a></td>
              <td><a href="javascript:if(confirm('确认要还原数据吗？')) window.location='{:U($module_name.'/recover?do=import&filename='.$vo[name])}'">还原数据</a></td>
            </tr>
            </volist>

          </tbody>
         </table>
    </form>

    </div>
</div>
</block>